#import "TalkingdataPlugin.h"
#import "TalkingDataSDK.h"

@interface TalkingdataPlugin()
@end

@implementation TalkingdataPlugin

+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
  FlutterMethodChannel* channel = [FlutterMethodChannel
      methodChannelWithName:@"talkingdata"
            binaryMessenger:[registrar messenger]];
  TalkingdataPlugin* instance = [[TalkingdataPlugin alloc] init];
  [registrar addMethodCallDelegate:instance channel:channel];
}

- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
  if ([@"initTalkingdata" isEqualToString:call.method]) {
      [TalkingDataSDK init:@"A1010E5C390C41008A201F76ACB51496" channelId:@"AppStore" custom:@""];
      result([TalkingDataSDK getDeviceId]);
  } else {
      result(FlutterMethodNotImplemented);
  }
}

@end
